package com.springboot.demo.design.pattern.palace;

import com.springboot.demo.design.pattern.idempotent.IdempotentHelper;
import com.springboot.demo.design.pattern.operator.Practicer;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Palace工厂类
 *
 * @author supu
 * @date 2019-03-20 9:54
 **/
@Component
public class PalaceFactory implements InitializingBean {
    @Autowired
    private Practicer practicer;
    @Autowired
    private IdempotentHelper idempotentHelper;

    private Palace palace;

    public Palace getPalace() {
        return palace;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        palace = new StandardPalace(practicer, idempotentHelper);
    }
}
